/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui;

import configureCharts.GenerateGraphs;
import controlcharts.*;
import data.DataSetCsvIterator;
import data.DataSetException;
import data.DataSetIterate;
import indices.IndicesDFuncao;
import java.awt.Dimension;
import java.io.File;
import java.util.ArrayList;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.jfree.chart.ChartFrame;
import statistic.*;
import types.DataConverter;
import types.DoubleDataConverter;

/**
 *
 * @author saul
 */
public class ok extends javax.swing.JFrame {

    /**
     * Creates new form ok
     */
    public ok() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem31 = new javax.swing.JMenuItem();
        jMenu9 = new javax.swing.JMenu();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenu13 = new javax.swing.JMenu();
        jMenuItem19 = new javax.swing.JMenuItem();
        jMenuItem30 = new javax.swing.JMenuItem();
        jMenuItem21 = new javax.swing.JMenuItem();
        jMenu14 = new javax.swing.JMenu();
        jMenuItem32 = new javax.swing.JMenuItem();
        jMenuItem22 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem25 = new javax.swing.JMenuItem();
        jMenu12 = new javax.swing.JMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenu11 = new javax.swing.JMenu();
        jMenuItem26 = new javax.swing.JMenuItem();
        jMenuItem27 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenu10 = new javax.swing.JMenu();
        help = new javax.swing.JMenuItem();
        jMenu8 = new javax.swing.JMenu();
        jMenuItem15 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setText("   ------------------------Bem Vindo ao SAGGC vs 2.0-Pressione F1 para Ajuda---------------------------------------\n");
        jTextArea1.setSelectionColor(new java.awt.Color(204, 204, 204));
        jScrollPane1.setViewportView(jTextArea1);

        jMenu1.setText("Variaveis");

        jMenu5.setText("Nivel");

        jMenuItem1.setText("Media");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem1);

        jMenuItem2.setText("Mediana");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem2);

        jMenu1.add(jMenu5);

        jMenu6.setText("Dispersão");

        jMenuItem3.setText("D.Padrão (S)");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem3);

        jMenuItem4.setText("Variancia (S^2)");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem4);

        jMenuItem5.setText("Amplitude (R)");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem5);

        jMenu1.add(jMenu6);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Atributos");

        jMenuItem31.setText("c");
        jMenuItem31.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem31ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem31);

        jMenu9.setText("p");

        jMenuItem13.setText("Tam. Fixo");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu9.add(jMenuItem13);

        jMenuItem16.setText("Variavel");
        jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem16ActionPerformed(evt);
            }
        });
        jMenu9.add(jMenuItem16);

        jMenuItem17.setText("T. medio");
        jMenuItem17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem17ActionPerformed(evt);
            }
        });
        jMenu9.add(jMenuItem17);

        jMenuItem18.setText("Padronizado P");
        jMenuItem18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem18ActionPerformed(evt);
            }
        });
        jMenu9.add(jMenuItem18);

        jMenu2.add(jMenu9);

        jMenu13.setText("nP");

        jMenuItem19.setText("T. Variavel");
        jMenuItem19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem19ActionPerformed(evt);
            }
        });
        jMenu13.add(jMenuItem19);

        jMenuItem30.setText("T. fixo");
        jMenuItem30.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem30ActionPerformed(evt);
            }
        });
        jMenu13.add(jMenuItem30);

        jMenuItem21.setText("T. medio");
        jMenuItem21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem21ActionPerformed(evt);
            }
        });
        jMenu13.add(jMenuItem21);

        jMenu2.add(jMenu13);

        jMenu14.setText("u");

        jMenuItem32.setText("Tam.fixo");
        jMenuItem32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem32ActionPerformed(evt);
            }
        });
        jMenu14.add(jMenuItem32);

        jMenuItem22.setText("Tam.variavel");
        jMenuItem22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem22ActionPerformed(evt);
            }
        });
        jMenu14.add(jMenuItem22);

        jMenu2.add(jMenu14);

        jMenuBar1.add(jMenu2);

        jMenu4.setText("Multivariado");

        jMenuItem25.setText("T^2 de Hotelling");
        jMenu4.add(jMenuItem25);

        jMenuBar1.add(jMenu4);

        jMenu12.setText("Medidas Individuais");

        jMenuItem6.setText("MR");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem6);

        jMenuItem7.setText("Xbar");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu12.add(jMenuItem7);

        jMenuBar1.add(jMenu12);

        jMenu11.setText("Outros Tipos");

        jMenuItem26.setText("Regressão");
        jMenuItem26.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem26ActionPerformed(evt);
            }
        });
        jMenu11.add(jMenuItem26);

        jMenuItem27.setText("CUSUM");
        jMenuItem27.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem27ActionPerformed(evt);
            }
        });
        jMenu11.add(jMenuItem27);

        jMenuBar1.add(jMenu11);

        jMenu3.setText("Indices de Capacidade");

        jMenuItem8.setText("Calcular");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem8);

        jMenuBar1.add(jMenu3);

        jMenu10.setText("Ajuda");

        help.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        help.setText("Sobre o SISCEQ");
        help.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                helpActionPerformed(evt);
            }
        });
        jMenu10.add(help);

        jMenuBar1.add(jMenu10);

        jMenu8.setText("Exit");

        jMenuItem15.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem15.setText("Sair");
        jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem15ActionPerformed(evt);
            }
        });
        jMenu8.add(jMenuItem15);

        jMenuBar1.add(jMenu8);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 990, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 429, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void helpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpActionPerformed
//        this.setVisible(true);
       // Help ajuda = new Help(this);
      //  ajuda.setVisible(true);
        jScrollPane1.setViewportView(new Help_1());   

    }//GEN-LAST:event_helpActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
       this.setVisible(true);
        GenericStatistic statistic = new VarianceStatistic(true);
        GenericChartLimits limites = new VarianceChartLimits();//alterar limites
        File arquivo = abrirArquivo();
        ChartFrame frame;
         try {
            frame = new ChartFrame("Gerando Gr�fico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excess�o
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        this.setVisible(true);
        GenericStatistic statistic = new StandardDeviationStatistic(true);
        GenericChartLimits limites = new StandardDeviationChartLimits();
        
        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gr�fico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excess�o
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
      this.setVisible(true);
	GenericStatistic statistic = new AmplitudeStatistic();
	GenericChartLimits limites = new AmplitudeChartLimits(); 
	File arquivo = abrirArquivo();
	ChartFrame frame;		
	try 
	{
		frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo,limites));
		frame.pack();
		frame.setVisible(true);                        
		Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();                          
		frame.setLocation(200,200);                        
	} catch (DataSetException e) {
		// TODO tratar essa excessão
		e.printStackTrace();
	}	
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
       this.setVisible(true);
	GenericStatistic statistic = new AverageStatistic();
	GenericChartLimits limites = new AverageChartLimits(); 
	File arquivo = abrirArquivo();
	ChartFrame frame;		
	try 
	{
		frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo,limites));
		frame.pack();
		frame.setVisible(true);                        
		Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();                          
		frame.setLocation(200,200);                        
	} catch (DataSetException e) {
		// TODO tratar essa excessão
		e.printStackTrace();
	}
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        SelectEstimator_1 control_chart = new SelectEstimator_1(this);		
        control_chart.show(true); 
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
       this.setVisible(true);
	GenericStatistic statistic = new MovingRangeStatistic();
	GenericChartLimits limites = new MovingRangeChartLimits(); 
	File arquivo = abrirArquivo();
	ChartFrame frame;		
	try 
	{
		frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
		frame.pack();
		frame.setVisible(true);                        
		Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();                          
		frame.setLocation(200,200);                        
	} catch (DataSetException e) {
		// TODO tratar essa excessão
		e.printStackTrace();
	}	
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem26ActionPerformed
         RegressionStatistic statistic = new RegressionStatistic();
		RegressionChartLimits limites = null; 
		File arquivo = OpenActionPerformed(evt);
		ChartFrame frame;
		try 
		{
			frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo,limites));
			Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();                          
			frame.setLocation(200,200);                
			frame.pack();
			frame.setVisible(true);
		}
		catch (DataSetException e) 
		{
			e.printStackTrace();
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
		//frame.setLocationByPlatform(true);
    }//GEN-LAST:event_jMenuItem26ActionPerformed

    private void jMenuItem27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem27ActionPerformed
        CusumChartLimits limites = null;
	CusumStatistic statistic1 = null;
	CusumStatistic statistic2 = null;
	//mudar
	
	double k = 0.5;
	//TODO mudar o k pra pegar da interface
	
	File arquivo = OpenActionPerformed(evt);
	ChartFrame frame;
	try 
	{
		limites = new CusumChartLimits();
		statistic1 = new CusumStatistic(true,k,limites);
		statistic2 = new CusumStatistic(false,k,limites);
		frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.doubleLineChart(statistic1,statistic2, arquivo,limites));
		Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
		frame.setSize(screenSize);
		frame.setLocation(200,200);                
		frame.pack();
		frame.setVisible(true);
		
		ArrayList<Integer> n_plus = statistic1.getStored_Ns();
		ArrayList<Integer> n_minus = statistic2.getStored_Ns();
		
		this.jTextArea1.setText("n" +"\t" +"ni+" +"\t" +"ni-");
		
		for(int cont=0;cont<n_plus.size();cont++)
		{
			this.jTextArea1.append("\n"+(cont+1)+"\t"+n_plus.get(cont)+"\t"+n_minus.get(cont));
		}
	}
	catch (DataSetException e) 
	{
		e.printStackTrace();
		JOptionPane.showMessageDialog(this, e.getMessage());
	}
	catch (Exception e) 
	{
		e.printStackTrace();
		JOptionPane.showMessageDialog(this, e.getMessage());
	}
    }//GEN-LAST:event_jMenuItem27ActionPerformed

    private void jMenuItem31ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem31ActionPerformed
        // TODO add your handling code here:
        this.setVisible(true);
        GenericStatistic statistic = new nPStatistic();
        CChartLimits limites = new CChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem31ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
      this.setVisible(true);
	GenericStatistic statistic = new MeanStatistic();
	GenericChartLimits limites = new XIndividualChartLimits(); 
	File arquivo = OpenActionPerformed(evt);
	ChartFrame frame;		
	try 
	{
		frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo,limites));
		frame.pack();
		frame.setVisible(true);                        
		Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();                          
		frame.setLocation(200,200);                        
	} catch (DataSetException e) {
		// TODO tratar essa excessão
		e.printStackTrace();
	}
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
     
         this.setVisible(true);
       GenericStatistic statistic = new PStatistic();
       GenericChartLimits limites = new PChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem30ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem30ActionPerformed
        //PutNp control_chartMedia2 = new PutNp(this);		
	//control_chartMedia2.show(true);
        this.setVisible(true);
       GenericStatistic statistic = new nPStatistic();
       GenericChartLimits limites = new nPChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem30ActionPerformed

    private void jMenuItem32ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem32ActionPerformed
        //PutU control_chartMedia3 = new PutU(this);		
	//control_chartMedia3.show(true);
        this.setVisible(true);
       // String constante = this.textFieldConstanteP.getText();
        //double constante_double = Double.parseDouble(constante);

        GenericStatistic statistic = new UStatistic();
       GenericChartLimits limites = new UChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem32ActionPerformed

    private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem15ActionPerformed
        // TODO add your handling code here:
        System.exit(EXIT_ON_CLOSE);
    }//GEN-LAST:event_jMenuItem15ActionPerformed

    private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed
       this.setVisible(true);
       GenericStatistic statistic = new VarPStatistic();
       GenericChartLimits limites = new VarPChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem16ActionPerformed

    private void jMenuItem17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem17ActionPerformed
        this.setVisible(true);
        GenericStatistic statistic = new VPStatistic();
        MPChartLimits limites = new MPChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem17ActionPerformed

    private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed
        this.setVisible(true);
        ZiPChartLimits limites = new ZiPChartLimits();
	GenericStatistic statistic = new ZiPStatistic(limites);
	//ZiPChartLimits limites = new ZiPChartLimits(); 
	File arquivo = abrirArquivo();
       
	ChartFrame frame;       
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem18ActionPerformed

    private void jMenuItem21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem21ActionPerformed
        // t.medio nP reverr aqui funções de statistic e limits 
        this.setVisible(true);
        GenericStatistic statistic = new nPStatistic();
        GenericChartLimits limites = new MnPChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem21ActionPerformed

    private void jMenuItem19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem19ActionPerformed
       //np Variavel
        this.setVisible(true);
        GenericStatistic statistic = new nPStatistic();
       GenericChartLimits limites = new VarnPChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        }
    }//GEN-LAST:event_jMenuItem19ActionPerformed

    private void jMenuItem22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem22ActionPerformed
        // TODO add your handling code here:
        this.setVisible(true);
        GenericStatistic statistic = new PStatistic();
       GenericChartLimits limites = new VarUChartLimits();

        File arquivo = abrirArquivo();
        ChartFrame frame;
        try {
            frame = new ChartFrame("Gerando Gráfico", GenerateGraphs.lineChart(statistic, arquivo, limites));
            frame.pack();
            frame.setVisible(true);
            Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            frame.setLocation(200, 200);
        } catch (DataSetException e) {
            // TODO tratar essa excessão
            e.printStackTrace();
        } 
        
    }//GEN-LAST:event_jMenuItem22ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
       PutIndice control_chartMedia = new PutIndice(this);		
	control_chartMedia.show(true);
    }//GEN-LAST:event_jMenuItem8ActionPerformed
  private File OpenActionPerformed(java.awt.event.ActionEvent evt) {
        return this.abrirArquivo();
    }
    /**
     * @param args the command line arguments
     */
    public static File abrirArquivo()
{
	JFileChooser chooser = new JFileChooser();
	chooser.showOpenDialog(null);
	File arquivo = chooser.getSelectedFile();

	if(arquivo==null)
	{
		System.out.println("Arquivo null");
	}
	return arquivo;
}

    public static void main(String args[]) {
       java.awt.EventQueue.invokeLater(new Runnable() {
		public void run() {
			new ok().setVisible(true);   				

		}
	});
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem help;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu10;
    private javax.swing.JMenu jMenu11;
    private javax.swing.JMenu jMenu12;
    private javax.swing.JMenu jMenu13;
    private javax.swing.JMenu jMenu14;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu8;
    private javax.swing.JMenu jMenu9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem19;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem22;
    private javax.swing.JMenuItem jMenuItem25;
    private javax.swing.JMenuItem jMenuItem26;
    private javax.swing.JMenuItem jMenuItem27;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem30;
    private javax.swing.JMenuItem jMenuItem31;
    private javax.swing.JMenuItem jMenuItem32;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JScrollPane jScrollPane1;
    public javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
}
